import { applyMiddleware, combineReducers, createStore } from "redux";
import { thunk } from "redux-thunk";
import { configureStore } from "@reduxjs/toolkit";

import counterReducer from './counter'
import homeReducer from './home'
import detailReducer from './detail'
import detail from "./detail";


// 派发一个函数
// const store = createStore(homeReducer,applyMiddleware(thunk))

// 合并多个reducer
// const store = createStore(combineReducers({
//   countInfo:counterReducer,
//   home:homeReducer
// }),applyMiddleware(thunk))

const store = configureStore({
  reducer:combineReducers({
    countInfo:counterReducer,
    home:homeReducer,
    detail:detailReducer
  }),
  // middleware:(getDefaultMiddleware)=>getDefaultMiddleware().concat(thunk)
})

export default store